/* Original Author:  Dominick O'Dierno
 * Date: 2007   odiernod@gmail.com     --Originally intended for use with DOMercury:  http://www.odierno.com/domercury
 * Description: The form to add and subtract file extensions to be ignored from the Index
 * 
 * --CHANGELOG--
 * 
 * */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DOMercury.Managers;

namespace DOMercury.Forms
{
    public partial class IndexFilters : Form
    {
        public IndexFilters()
        {
            InitializeComponent();
            ResetlbExtDataSource();
        }

        private void IndexFilters_Load(object sender, EventArgs e)
        {

        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            IndexManager.FileExtensionsToIgnore.Add(txtExt.Text.Trim().ToLower());
            ResetlbExtDataSource();
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            IndexManager.FileExtensionsToIgnore.Remove((string)lbExt.SelectedItem);
            ResetlbExtDataSource();
            
        }
        private void ResetlbExtDataSource()
        {
            lbExt.DataSource = null;
            lbExt.DataSource = IndexManager.FileExtensionsToIgnore;
        }

        private void IndexFilters_FormClosing(object sender, FormClosingEventArgs e)
        {
            IndexManager.SaveIgnoredFileExtensions();
            
        }
    }
}